package com.farm.bpm.dao;

import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

/**
 * 流程实例
 * 
 * @author MAC_wd
 * 
 */
public class FarmBpmDao implements FarmBpmDaoInter {
	private SessionFactory sessionFatory;

	@Override
	public void setPROC_INST_ID_Null(String id) {
		Session session = sessionFatory.getCurrentSession();
		SQLQuery sqlquery = session
				.createSQLQuery("UPDATE act_ru_execution SET PROC_INST_ID_ = NULL WHERE   ID_ = ? ");
		sqlquery.setString(0, id);
		sqlquery.executeUpdate();
	}

	public SessionFactory getSessionFatory() {
		return sessionFatory;
	}

	public void setSessionFatory(SessionFactory sessionFatory) {
		this.sessionFatory = sessionFatory;
	}

	@Override
	public void editProcessDefTitleDescription(String processDefId,
			String titleDescription) {
		Session session = sessionFatory.getCurrentSession();
		SQLQuery sqlquery = session
				.createSQLQuery("UPDATE act_re_procdef SET DESCRIPTION_ = ?  WHERE  ID_ = ? ");
		sqlquery.setString(0, titleDescription);
		sqlquery.setString(1, processDefId);
		sqlquery.executeUpdate();

	}

}
